<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<%@ page import="java.sql.*, pkg.BaseEngine, pkg.BaseMenu" %>
<jsp:useBean id="BaseEngine" scope="session" class="pkg.BaseEngine"/>
<jsp:useBean id="BaseMenu" scope="session" class="pkg.BaseMenu"/>
<%
String username = request.getParameter( "username" );
String password = request.getParameter( "password" );
String logout = request.getParameter( "logout" );
%>
<%
if (logout!=null&&logout.equals("1")) {
	session.removeAttribute("user");
	session.removeAttribute("Baza");
}
else if (username != null){
	BaseEngine base = new BaseEngine();
	if (base.connect(username, password)){
		session.setAttribute("user", username);
		session.setAttribute("Baza", base);
	}
	request.setAttribute("error_login","Bledny login");
}
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Baza Danych - Google API</title>
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
	<a href="index.jsp"><img src="Logo.jpg" alt="Logo" width="135" height="100" class="img2"/></a><h1>Baza Danych - Google API</h1>
</div>
<div id="content">
	
	<div id="colOne">
		<%
		String login = (String) session.getAttribute( "user" );
		if (login == null) {						
			out.println("<FORM METHOD=POST ACTION=\"base_index.jsp\">");
			out.println("<TABLE>");
			out.println("<TR>");
				out.println("<TD width = 100>Login:</TD>");
				out.println("<TD><INPUT TYPE=TEXT NAME=username SIZE=20></TD>");
			out.println("</TR>");
			out.println("<TR>");
				out.println("<TD>Hasło:</TD>");
				out.println("<TD><INPUT TYPE=PASSWORD NAME=password SIZE=20></TD>");
			out.println("</TR>");
			out.println("</TABLE>");
			out.println("<P align=\"center\"><INPUT TYPE=submit value=\"Zaloguj\"></P>");
			out.println("</FORM>");
			//out.println("<p align=\"left\"><a href=\"nowy.jsp\">Zarejestruj się</a></p>");
		} else {
			out.println("<p align=\"center\">Zalogowano: "+login+"</p>");
			out.println("<p align=\"center\"><a href=\"base_index.jsp?logout=1\">Wyloguj się</a></p>");
		}
		%>
		<div id="menu1">
			<ul>
				<%= BaseMenu.printBaseMenu(session) %>
			</ul>
		</div>
		<div class="margin-news">
		</div>
	</div>
	<div id="colTwo">
		<%= BaseMenu.printView(session, request) %> 
		
	</div>
	<div style="clear: both;">&nbsp;</div>
</div>
<div id="footer">
	<p>Copyright &copy; 2008 F.Szura. Template from <a href="http://freecsstemplates.org" target="blank">Free CSS Templates</a></p>
</div>
</body>
</html>